<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    function show1 () {
      let pro = new Promise(function (resolve, reject) {
        setTimeout(() => {
          console.log("1秒定时器");
          resolve("1秒定时器")
          // reject("1秒失败")
        }, 1000);
      })
      return pro;
    }
    function show2 () {
      return new Promise(function (resolve, reject) {
        setTimeout(() => {
          console.log("2秒定时器");
          resolve("2秒定时器")
          // reject("2秒失败")
        }, 2000);
      })

    }
    function show3 () {
      return new Promise(function (resolve, reject) {
        setTimeout(() => {
          console.log("3秒定时器");
          resolve("3秒定时器")
          // reject("3秒失败")
        }, 3000);
      })
    }

    async function test () {
      await show3().then(data => {
        console.log(data);
      }).catch(err => {
        console.log(err);
      });
      await show2().then(data => console.log(data)).catch(err => console.log(err))
      await show1();
    }
    test()
  </script>
</body>

</html>